package com.moresir.validatetools.rules.list.number;

import com.moresir.validatetools.impl.Form;
import com.moresir.validatetools.rules.list.AbstractRule;

import java.util.Optional;

public class RuleLongMax extends AbstractRule {
    @Override
    public boolean isOkay(Form f) {
        Optional<Long> s = f.getLong(rule.getField());
        Long beComparedValue = Long.parseLong(rule.getParams().get(0));
        return s.isPresent() && s.get().longValue() <= beComparedValue.longValue();
    }
}
